package me.zuoyun.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

import me.zuoyun.User;
import me.zuoyun.repo.UserRepo;

/**
 * Created by ZuoYun on 07/01/2018.
 * Time: 5:38 PM
 * Information:
 */

@RestController
@RequestMapping("/api")
public class BaseController {

  @Resource
  private UserRepo userRepo;

  @RequestMapping("/list")
  public Object list() {
    return userRepo.findAll();
  }

  @RequestMapping("/insert")
  public Object insert() {
    return userRepo.save(new User().setId(2).setUsername("zuoyun").setPassword("xxx"));
  }

}
